/*
 * entity.cpp
 *
 *  Created on: 09.10.2014
 *      Author: Niall
 */

#include "entity.hpp"
#include <iostream>

Entity::Entity(std::string name, std::string pathToSprite, int x, int y)
{
	_name 			= name;
	_pathToSprite 	= pathToSprite;
	_pos			= sf::Vector2i(x, y);
	_movementSpeed 	= 1;
	_scale			= 1;

	if (!_texture.loadFromFile(pathToSprite)) std::cout << "Error loading texture.";
	_sprite.setTexture(_texture);
	_sprite.setPosition((float) _pos.x, (float) _pos.y);
}

void Entity::setPositionRel(int x, int y)
{
	_pos.x			= _pos.x + x;
	_pos.y	 		= _pos.y + y;

	_sprite.setPosition((float) _pos.x, (float) _pos.y);
}
